from django.contrib import admin
from .models import WeiboModel, CommentModel, UserUpload


# Register your models here.
class WeiboAdmin(admin.ModelAdmin):
    empty_value_display = 'null'

    # 配置显示哪些字段
    list_display = ['id', 'text', 'topic', 'num1', 'date']
    # 过滤字段
    list_filter = ['flag']

    # readonly_fields = ['password']
    # 分页
    list_per_page = 30


admin.site.register(WeiboModel, WeiboAdmin)


class CommentAdmin(admin.ModelAdmin):
    empty_value_display = 'null'

    # 配置显示哪些字段
    list_display = ['id', 'content', 'ip_location', 'created_at', 'gender']
    # 过滤字段
    # list_filter = ['flag']

    # readonly_fields = ['password']
    # 分页
    list_per_page = 30


admin.site.register(CommentModel, CommentAdmin)


class UploadAdmin(admin.ModelAdmin):
    empty_value_display = 'null'

    # 配置显示哪些字段
    list_display = ['id', 'title', 'file', 'timestamp', 'uploader']
    # 过滤字段
    list_filter = ['timestamp', 'uploader']

    # readonly_fields = ['password']
    # 分页
    list_per_page = 30


admin.site.register(UserUpload, UploadAdmin)
